package org.zj.springstyle.mvc.controller;

import org.zj.springstyle.mvc.domain.IController;
import org.zj.springstyle.mvc.domain.SuperDomain;
import org.zj.springstyle.mvc.domain.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by zhaoji on 14/12/24.
 */
public class LoginController implements IController {


    @Override
    public String execute(HttpServletRequest request,HttpServletResponse response, SuperDomain superDomain, Map<String, String> forward) {
        User user = (User)superDomain;
        String url = "FAIL";
        if(user.getUsername().equals("zj")){
            url = "SUCCESS";
        }
        return forward.get(url);
    }


}
